﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpObjects.Configuration.ConfigurationProviders;
using SharpObjects.Instantiation;
using SharpObjects.PathMapping;

namespace SharpObjects.Configuration
{
    public class ConfigurationProviderFactory
    {
        public static IConfigurationProvider GetConfigurationProvider(string fileName = "SharpConfiguration.config", string xpath = "/*/configuration")
        {
            fileName = PathMapperFactory.PathMapper.MapAssemblyBasePath(fileName);
            XmlConfigurationProvider xmlConfigurationProvider = new XmlConfigurationProvider(fileName, PathMapperFactory.PathMapper);
            IConfigurationProvider configurationProvider = xmlConfigurationProvider.GetObject<IConfigurationProvider>(xpath);
            return configurationProvider;
        }
    }
}
